473,425 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

confirm closing web page

I've this problem.
I need, when the user close the web page, to show a message of confirm with
Ok and cancel.
With the event unload when I click cancel the web page closes however.
What can I do ?
Sorry for the bad English.
Hello.
Jul 20 '05 #1
4 16070
I found,
thanks

<SCRIPT LANGUAGE="JavaScript" EVENT="onbeforeunload()" FOR="window">
event.returnValue = "Chiudi questa finestra ! Sei sicuro?";
</SCRIPT>
"Fabrizio" <fa*************@atenait.it> ha scritto nel messaggio
news:7q**********************@twister1.libero.it.. .
I've this problem.
I need, when the user close the web page, to show a message of confirm with Ok and cancel.
With the event unload when I click cancel the web page closes however.
What can I do ?
Sorry for the bad English.
Hello.

Jul 20 '05 #2
I think that onbeforeunload() event will only work with IE!

But not sure on that info...anybody!??

Respect...

p.

"Fabrizio" <fa*************@atenait.it> wrote in message
news:DN**********************@twister2.libero.it.. .
I found,
thanks

<SCRIPT LANGUAGE="JavaScript" EVENT="onbeforeunload()" FOR="window">
event.returnValue = "Chiudi questa finestra ! Sei sicuro?";
</SCRIPT>
"Fabrizio" <fa*************@atenait.it> ha scritto nel messaggio
news:7q**********************@twister1.libero.it.. .
I've this problem.
I need, when the user close the web page, to show a message of confirm

with
Ok and cancel.
With the event unload when I click cancel the web page closes however.
What can I do ?
Sorry for the bad English.
Hello.


Jul 20 '05 #3
If you want to manually control the close via a link on your page then just
write a function that will do that.

function confirmClose() {
if (confirm("Are you sure that you want to close this window?")) {
top.close();
//or self.close();
}
}

If you want to capture a user clicking on the close icon in the top right of
a browser such as IE or NetScape, then I don't know how you would capture
this via JavaScript.

Peter.
"point" <in**@caanproduction.com> wrote in message
news:be*********@enews2.newsguy.com...
I think that onbeforeunload() event will only work with IE!

But not sure on that info...anybody!??

Respect...

p.

"Fabrizio" <fa*************@atenait.it> wrote in message
news:DN**********************@twister2.libero.it.. .
I found,
thanks

<SCRIPT LANGUAGE="JavaScript" EVENT="onbeforeunload()" FOR="window">
event.returnValue = "Chiudi questa finestra ! Sei sicuro?";
</SCRIPT>
"Fabrizio" <fa*************@atenait.it> ha scritto nel messaggio
news:7q**********************@twister1.libero.it.. .
I've this problem.
I need, when the user close the web page, to show a message of confirm

with
Ok and cancel.
With the event unload when I click cancel the web page closes however.
What can I do ?
Sorry for the bad English.
Hello.



Jul 20 '05 #4
In article <lU*******************@newsfep1-win.server.ntli.net>, "ManoDestra"
<ma*****************@ntlworld.com> writes:
If you want to capture a user clicking on the close icon in the top right of
a browser such as IE or NetScape, then I don't know how you would capture
this via JavaScript.


Post
Top
Dont
Please

You can't detect how I left a page other than your mentioned script. Other than
that, you have no way of knowing if I closed the browser, clicked a favorite,
typed a URL in, only that I left.
--
Randy
All code posted is dependent upon the viewing browser
supporting the methods called, and Javascript being enabled.
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Terry | last post by:
anyone know how to pop up a confirm window with (Y) & (N)?? I want to pop up a "Do you want to continue?" message box (javascript only, can't use vbscript) with (Y) & (N). when click (N), then...
4
by: JohnSouth104 | last post by:
Hi I want to warn the user that changing the selected item in a pull-down will clear some data he has already entered in a file download box. I've tried using confirm() to return true or false...
10
by: Mike Malter | last post by:
I have scoured the web looking for an example of how to do a javascript confirm box in .NET. Is there any way to do it? Thanks.
2
by: mark | last post by:
im having issues in creating a javascript confirm option on pressing a delete button in a datagrid - ive tried a few things but nothing seems to work (either crashes or does nothing) my codebehind...
7
by: Grey | last post by:
how to design confirm message box, like Javascript Confirm box, in ASP.NET?? if the user click "YES" in the confirm box, i need to do something, else do other things. Do I need to have javascript...
8
by: rn5a | last post by:
I have gone through a no. of posts in this NewsGroup regarding my problem but alas, couldn't come across one which would have helped me in resolving the issue. My problem is this: An ASPX Form...
1
by: miztadux | last post by:
After a google search I found this old (closed) thread here. I just wanted to add that you can use the "onbeforeunload" event in most browser to override the close button behavior. You can, for...
4
by: ChrisA | last post by:
I need to get the user to confirm a button push/postback with a popup from the browser, in ASP.NET 1.1. What's the right way to wire that up?? Thanks
10
by: =?ISO-8859-1?Q?G=E9rard_Talbot?= | last post by:
www.authoring.stylesheets] Dear fellow CSS colleagues and web authors in alt.html discussion forum, I would like to ask you to help me confirm that there is a serious bug in IE 7 final release...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.